package OBJ_Loader;

import java.util.ArrayList;
import klient.Klient;

/**
 *  
 * @author Marcin & Bartek
 * 
 * @description It can contain information about object material
 * 
 */
public class MTLObj {
    private ArrayList<Material> list = new ArrayList<>();
    private Material lastM=null;
    private String lastS="";
    public Material get(String name){
        if(getLastS().equals(name))
            return getLastM();
        for(Material m:getList()){
            if(m.getName().equals(name)){
                setLastS(name);
                setLastM(m);
                return m;
            }
        }
        Klient.log("Nie znaleziono "+name);
        return null;
    }

    /**
     * @return the list
     */
    public ArrayList<Material> getList() {
        return list;
    }

    /**
     * @param list the list to set
     */
    public void setList(ArrayList<Material> list) {
        this.list = list;
    }

    /**
     * @return the lastM
     */
    public Material getLastM() {
        return lastM;
    }

    /**
     * @param lastM the lastM to set
     */
    public void setLastM(Material lastM) {
        this.lastM = lastM;
    }

    /**
     * @return the lastS
     */
    public String getLastS() {
        return lastS;
    }

    /**
     * @param lastS the lastS to set
     */
    public void setLastS(String lastS) {
        this.lastS = lastS;
    }
}
